package com.chen.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;

/**
 * @author chen
 * @version 1.0
 * @create_date 2025/8/20
 * 随机生成innerCode
 */
public class CodeUtils {
    private static final Random RANDOM = new Random();

    public static String getInnerCode() {
        StringBuilder sb = new StringBuilder();
        sb.append(0);
        for (int i = 0; i < 8; i++) {
            int num = RANDOM.nextInt(1, 11);
            sb.append(num);
        }
        return sb.toString();
    }

    public static String getTaskCode() {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        return dateTimeFormatter.format(now);
    }
}
